package com.iraeta.entity.basic.type;

import com.iraeta.entity.basic.HikRegion;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class HikRegionTreeNode extends HikRegion {
    public List<HikRegion> children;

    public void addNode(HikRegionTreeNode hikRegionTreeNode){
        if(children == null) this.children = new ArrayList<>();
        if(this.children.stream().anyMatch(x-> Objects.equals(x.getId(), hikRegionTreeNode.getId()))){
            return;
        }
        this.children.add(hikRegionTreeNode);
        hikRegionTreeNode.setParentindexcode(hikRegionTreeNode.getParentindexcode());
    }
}
